
@include('Home.head')
<body>
<div class="container" id="app">
    @include('Home.member.header')
    <div class="my-nav-bar">
    	<ol class="am-breadcrumb">
          <li><a href="#">首页</a></li>
          <li><a href="#">提现</a></li>
        </ol>
    </div>
	<div class="cart-panel">
        <div class="gray-panel">
            {{--<div class="my-search-title-panel am-text-sm am-margin-bottom-sm"><i class="am-icon-lightbulb-o am-text-danger"></i> 提示：实际的运费可能因为收货地址的不同而有差异，具体以提交之后系统计算或卖家协商为准</div>--}}
            <div class="paoduct-title-panel">
                <form class="am-form am-form-inline">
                    <div class="am-form-group">
                        <h3>币种</h3>
                        <label class="am-checkbox-inline">
                            <input type="radio" v-model="user.type" name="type" value="1" data-am-ucheck> 电子币
                        </label>
                        <label class="am-checkbox-inline">
                            <input type="radio" v-model="user.type" name="type" value="2" data-am-ucheck> 积分
                        </label>
                        <label class="am-checkbox-inline">
                            <input type="radio" v-model="user.type" name="type" value="3" data-am-ucheck> 奖励币
                        </label>
                    </div>
                    <div class="am-form-group am-form-icon">
                        <i class="am-icon-mobile-phone"></i>
                        <input type="number" v-model="user.phone" class="am-form-field am-radius" placeholder="接收人电话">
                    </div>
                    <div class="am-form-group am-form-icon">
                        <i class="am-icon-yen"></i>
                        <input type="text" v-model="user.money" class="am-form-field am-radius" placeholder="转出金额 必须是整数">
                    </div>
                    <div class="am-form-group am-form-icon">
                        <i class="am-icon-unlock-alt"></i>
                        <input type="password" v-model="user.password" class="am-form-field am-radius" placeholder="支付密码">
                    </div>
                    <input type="hidden" value="1" name="paytype" id="paytype">
                    <p class="am-text-center"><button style="background-color: black;color: rgb(255,215,0);" type="button" class="am-btn am-btn-danger am-radius am-btn-block" v-on:click="add()">确定</button></p>
                </form>
            </div>
        </div>
        <h3>转账记录</h3>
        <div class="withdrawals-panel">
        	<table class="am-table am-table-striped am-table-hover comm-table">
            	<thead>
                    <tr>
                        <th>金额</th>
                        <th>收款人</th>
                        <th>日期</th>
                    </tr>
                </thead>
                <tbody>
                	<tr v-for="val in deposit">
                        <td>@{{ val.money }}</td>
                        <td>@{{ val.nickname }}</td>
                        <td>@{{ val.time }}</td>
                    </tr>
                </tbody>
            </table>
        </div>
    </div>
    <!--底部-->
    @include('Home.foot')
</div>
</body>
<script>
    var app = new Vue({
        el: "#app",
        data: {
            title: '转账',
            user:{
                type:1,
                phone:'',
                money:'',
                password:'',
            },
            deposit:[],
        },
        methods: {
            //初始化 系统管理员列表
            initialize: function () {
                $.post("/home/member/deposit", {'_token': '{{csrf_token()}}',class:'select'}, function (res) {
                    if (res.code) {
                        app.deposit = res.data;
                    } else {
                        layer.msg(res.data);
                    }
                });
            },
            add:function () {
                if(!(/^[1][3,4,5,7,8,9][0-9]{9}$/.test(app.user.phone))){
                    layer.msg('请输入正确的电话号码');
                    return false;
                }
                if(!(/^\+?[1-9][0-9]*$/.test((app.user.money / 100)))){
                    layer.msg('请输入100的倍数');
                    return false;
                }
                if(app.user.password == ''){
                    layer.msg('请输入密码');
                    return false;
                }
                $.post("/home/member/deposit", {'_token': '{{csrf_token()}}',class:'add',user:app.user}, function (res) {
                    if (res.code) {
                        layer.msg(res.data);
                        this.initialize();
                    } else {
                        layer.msg(res.data);
                    }
                });
            },
        },
        //自动执行
        mounted: function () {
            this.initialize();
        },
    })
</script>
</html>
